<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>lwIP: src/include/lwip/netdb.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">lwIP
   &#160;<span id="projectnumber">2.1.2</span>
   </div>
   <div id="projectbrief">Lightweight IP stack</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('lwip_2netdb_8h.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a> &#124;
<a href="#var-members">Variables</a>  </div>
  <div class="headertitle">
<div class="title">netdb.h File Reference</div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &quot;<a class="el" href="opt_8h.html">lwip/opt.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="arch_8h.html">lwip/arch.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="lwip_2inet_8h.html">lwip/inet.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="sockets_8h.html">lwip/sockets.h</a>&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:a0bb00f48d6ba1e8c55b7d85c8e3a19a7"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="lwip_2netdb_8h.html#a0bb00f48d6ba1e8c55b7d85c8e3a19a7">EAI_NONAME</a>&#160;&#160;&#160;200</td></tr>
<tr class="separator:a0bb00f48d6ba1e8c55b7d85c8e3a19a7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga39746b4b096060ca3e8c6ee7a7560b1d"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__netdbapi.html#ga39746b4b096060ca3e8c6ee7a7560b1d">gethostbyname</a>(name)&#160;&#160;&#160;<a class="el" href="lwip_2netdb_8h.html#a8adc6d35c068a073369edde71c678cbc">lwip_gethostbyname</a>(name)</td></tr>
<tr class="separator:ga39746b4b096060ca3e8c6ee7a7560b1d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga76204a4d646dba393f88aa9b0980fc07"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__netdbapi.html#ga76204a4d646dba393f88aa9b0980fc07">gethostbyname_r</a>(name,  ret,  buf,  buflen,  result,  h_errnop)&#160;&#160;&#160;<a class="el" href="lwip_2netdb_8h.html#afa229e90916f6c8d6308828f45351d2d">lwip_gethostbyname_r</a>(name, ret, buf, buflen, result, h_errnop)</td></tr>
<tr class="separator:ga76204a4d646dba393f88aa9b0980fc07"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab28cd3049bcf6e2bc3a71e968a64a92d"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__netdbapi.html#gab28cd3049bcf6e2bc3a71e968a64a92d">freeaddrinfo</a>(addrinfo)&#160;&#160;&#160;<a class="el" href="lwip_2netdb_8h.html#a7f65ff5982a0743849a644ef2cd15ef5">lwip_freeaddrinfo</a>(addrinfo)</td></tr>
<tr class="separator:gab28cd3049bcf6e2bc3a71e968a64a92d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga558191530d91c101621b49e43bd5bbf5"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__netdbapi.html#ga558191530d91c101621b49e43bd5bbf5">getaddrinfo</a>(nodname,  servname,  hints,  res)&#160;&#160;&#160;<a class="el" href="lwip_2netdb_8h.html#af356989c172a51187e22b557f22d4165">lwip_getaddrinfo</a>(nodname, servname, hints, res)</td></tr>
<tr class="separator:ga558191530d91c101621b49e43bd5bbf5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a8adc6d35c068a073369edde71c678cbc"><td class="memItemLeft" align="right" valign="top">struct hostent *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="lwip_2netdb_8h.html#a8adc6d35c068a073369edde71c678cbc">lwip_gethostbyname</a> (const char *name)</td></tr>
<tr class="separator:a8adc6d35c068a073369edde71c678cbc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afa229e90916f6c8d6308828f45351d2d"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="lwip_2netdb_8h.html#afa229e90916f6c8d6308828f45351d2d">lwip_gethostbyname_r</a> (const char *name, struct hostent *ret, char *buf, size_t buflen, struct hostent **result, int *h_errnop)</td></tr>
<tr class="separator:afa229e90916f6c8d6308828f45351d2d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7f65ff5982a0743849a644ef2cd15ef5"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="lwip_2netdb_8h.html#a7f65ff5982a0743849a644ef2cd15ef5">lwip_freeaddrinfo</a> (struct addrinfo *ai)</td></tr>
<tr class="separator:a7f65ff5982a0743849a644ef2cd15ef5"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af356989c172a51187e22b557f22d4165"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="lwip_2netdb_8h.html#af356989c172a51187e22b557f22d4165">lwip_getaddrinfo</a> (const char *nodename, const char *servname, const struct addrinfo *hints, struct addrinfo **res)</td></tr>
<tr class="separator:af356989c172a51187e22b557f22d4165"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:a2a1ce3f2040007303d36c0b682b5ac10"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="lwip_2netdb_8h.html#a2a1ce3f2040007303d36c0b682b5ac10">h_errno</a></td></tr>
<tr class="separator:a2a1ce3f2040007303d36c0b682b5ac10"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>NETDB API (sockets) </p>
</div><h2 class="groupheader">Macro Definition Documentation</h2>
<a id="a0bb00f48d6ba1e8c55b7d85c8e3a19a7"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0bb00f48d6ba1e8c55b7d85c8e3a19a7">&#9670;&nbsp;</a></span>EAI_NONAME</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define EAI_NONAME&#160;&#160;&#160;200</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Errors used by the DNS API functions, h_errno can be one of them </p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a id="a7f65ff5982a0743849a644ef2cd15ef5"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7f65ff5982a0743849a644ef2cd15ef5">&#9670;&nbsp;</a></span>lwip_freeaddrinfo()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void lwip_freeaddrinfo </td>
          <td>(</td>
          <td class="paramtype">struct addrinfo *&#160;</td>
          <td class="paramname"><em>ai</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Frees one or more addrinfo structures returned by <a class="el" href="group__netdbapi.html#ga558191530d91c101621b49e43bd5bbf5">getaddrinfo()</a>, along with any additional storage associated with those structures. If the ai_next field of the structure is not null, the entire list of structures is freed.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ai</td><td>struct addrinfo to free </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="af356989c172a51187e22b557f22d4165"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af356989c172a51187e22b557f22d4165">&#9670;&nbsp;</a></span>lwip_getaddrinfo()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int lwip_getaddrinfo </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>nodename</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>servname</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const struct addrinfo *&#160;</td>
          <td class="paramname"><em>hints</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct addrinfo **&#160;</td>
          <td class="paramname"><em>res</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Translates the name of a service location (for example, a host name) and/or a service name and returns a set of socket addresses and associated information to be used in creating a socket with which to address the specified service. Memory for the result is allocated internally and must be freed by calling <a class="el" href="netdb_8c.html#a7f65ff5982a0743849a644ef2cd15ef5">lwip_freeaddrinfo()</a>!</p>
<p>Due to a limitation in dns_gethostbyname, only the first address of a host is returned. Also, service names are not supported (only port numbers)!</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">nodename</td><td>descriptive name or address string of the host (may be NULL -&gt; local address) </td></tr>
    <tr><td class="paramname">servname</td><td>port number as string of NULL </td></tr>
    <tr><td class="paramname">hints</td><td>structure containing input values that set socktype and protocol </td></tr>
    <tr><td class="paramname">res</td><td>pointer to a pointer where to store the result (set to NULL on failure) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, non-zero on failure</dd></dl>

</div>
</div>
<a id="a8adc6d35c068a073369edde71c678cbc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8adc6d35c068a073369edde71c678cbc">&#9670;&nbsp;</a></span>lwip_gethostbyname()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">struct hostent* lwip_gethostbyname </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Returns an entry containing addresses of address family AF_INET for the host with name name. Due to dns_gethostbyname limitations, only one address is returned.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>the hostname to resolve </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>an entry containing addresses of address family AF_INET for the host with name name </dd></dl>

</div>
</div>
<a id="afa229e90916f6c8d6308828f45351d2d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afa229e90916f6c8d6308828f45351d2d">&#9670;&nbsp;</a></span>lwip_gethostbyname_r()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int lwip_gethostbyname_r </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct hostent *&#160;</td>
          <td class="paramname"><em>ret</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">char *&#160;</td>
          <td class="paramname"><em>buf</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">size_t&#160;</td>
          <td class="paramname"><em>buflen</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">struct hostent **&#160;</td>
          <td class="paramname"><em>result</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>h_errnop</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">
<p>Thread-safe variant of lwip_gethostbyname: instead of using a static buffer, this function takes buffer and errno pointers as arguments and uses these for the result.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">name</td><td>the hostname to resolve </td></tr>
    <tr><td class="paramname">ret</td><td>pre-allocated struct where to store the result </td></tr>
    <tr><td class="paramname">buf</td><td>pre-allocated buffer where to store additional data </td></tr>
    <tr><td class="paramname">buflen</td><td>the size of buf </td></tr>
    <tr><td class="paramname">result</td><td>pointer to a hostent pointer that is set to ret on success and set to zero on error </td></tr>
    <tr><td class="paramname">h_errnop</td><td>pointer to an int where to store errors (instead of modifying the global h_errno) </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, non-zero on error, additional error information is stored in *h_errnop instead of h_errno to be thread-safe </dd></dl>

</div>
</div>
<h2 class="groupheader">Variable Documentation</h2>
<a id="a2a1ce3f2040007303d36c0b682b5ac10"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2a1ce3f2040007303d36c0b682b5ac10">&#9670;&nbsp;</a></span>h_errno</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int h_errno</td>
        </tr>
      </table>
</div><div class="memdoc">
<p>h_errno is exported in netdb.h for access by applications. </p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_b0856f6b0d80ccb263b2f415c91f9e17.html">include</a></li><li class="navelem"><a class="el" href="dir_4e6b3cf33a61b6caac9c8ac30c866f37.html">lwip</a></li><li class="navelem"><a class="el" href="lwip_2netdb_8h.html">netdb.h</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
